<template>
	<view>
		<uni-popup ref="hintPopupRef" type="center">
			<view class="appointment-block">
				<image src="../../static/public/hintPopup.png" class="hint-img"></image>
				<view class="item-option">
					<view class="hint-txt">姓名</view>
					<view class="input-opiton">
						<input class="input-class" v-model="param.name" placeholder-class="pl" placeholder="请输入姓名" />
					</view>
				</view>


				<view class="item-option">
					<view class="hint-txt">课程</view>
					<picker mode="selector" :value="classifyIndex" @change="classifyChange" :range="classifyArr"
						range-key='name'>
						<view class="input-opiton">
							<input class="input-class" v-model="classifyName" :disabled="true" placeholder="请选择你的课程" />
							<image src="../../static/public/sanjiaoxing.png" class="right-icon"></image>
						</view>
					</picker>
				</view>
				<view class="item-option">
					<view class="hint-txt">手机号码</view>
					<view class="input-opiton">
						<input class="input-class" v-model="param.phone" placeholder="请输入你的手机号码" />
					</view>
				</view>
				<view class="btn-submit" @click="submitClick">提交预约</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		name: "sumitPopup",
		props: {
			classifyArr: {
				type: Array,
				default: [],
			}
		},
		data() {
			return {
				campusIndex: 0,
				campusName: '',
				// classifyArr: [{
				// 		name: '课程一'
				// 	},
				// 	{
				// 		name: '课程二'
				// 	},
				// 	{
				// 		name: '课程三'
				// 	},
				// ],
				classifyIndex: 0,
				classifyName: '',
				detailObj: {},
				param: {
					name: '',
					courseName: '',
					phone: '',
				}
			};
		},
		methods: {
			openPopup() {
				this.$refs.hintPopupRef.open()
			},
			closePopup() {
				this.$refs.hintPopupRef.close()
			},
			campusChange(e) {
				console.log('e======', e)
				this.campusIndex = e.detail.value
				this.campusName = this.campusArr[this.campusIndex].name
			},
			clearParam() {
				this.param.name = ''
				this.classifyName = ''
				this.param.phone = ''
			},
			classifyChange(e) {
				console.log('e======', e)
				this.classifyIndex = e.detail.value
				this.classifyName = this.classifyArr[this.classifyIndex].name
			},
			submitClick() {
				console.log('pupue=======', this.param)
				console.log('campusName=======', this.classifyName)
				this.$emit('submitPopupChange',{
					name:this.param.name,
					adminId:uni.getStorageSync('adminId'),
					courseName:this.classifyName,
					phone:this.param.phone,
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content-info {
		margin-top: 16rpx;

		.img {
			background: skyblue;
			width: 750rpx;
			height: 468rpx;
		}

		.info-option {
			margin: 32rpx;

			.hint-txt {
				font-weight: 500;
				font-size: 36rpx;
				color: #202030;
				line-height: 1.5em;
			}

			.hint-price-info {
				margin-top: 42rpx;
				display: flex;
				align-items: center;

				span {
					font-weight: 500;
					font-size: 32rpx;
					color: #FA5858;
				}

				.txt {
					margin-left: 20rpx;
					font-weight: 400;
					font-size: 20rpx;
					color: #B4B4B4;

				}

				.tag-right {
					flex: auto;
					text-align: right;
					font-weight: 400;
					font-size: 20rpx;
					color: #B4B4B4;
				}
			}
		}
	}

	.bottom-fixed {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 444rpx;
		height: 98rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -6rpx 8rpx 0rpx rgba(0, 0, 0, 0.03);
		display: flex;
		align-items: center;

		.left-icon {
			flex: none;
			margin-left: 44rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.icon {
				width: 28rpx;
				height: 30rpx;
			}

			.txt {
				margin-top: 6rpx;
				font-weight: 500;
				font-size: 16rpx;
				color: #666666;
			}
		}

		.right-option {
			margin-right: 32rpx;
			flex: auto;
			display: flex;
			align-items: center;
			justify-content: flex-end;

			.btn-txt {
				width: 494rpx;
				height: 76rpx;
				line-height: 76rpx;
				text-align: center;
				background: #209E9A;
				border-radius: 56rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
			}
		}
	}


	.appointment-block {
		width: 654rpx;
		height: 760rpx;
		background: #FFFFFF;
		border-radius: 24rpx;

		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.hint-img {
			position: absolute;
			left: 34rpx;
			right: 34rpx;
			top: -90rpx;
			z-index: 999rpx;
			height: 175rpx;
			width: 590rpx;
		}

		.item-option {
			width: 542rpx;
			margin-top: 32rpx;

			.hint-txt {
				font-weight: 500;
				font-size: 28rpx;
				color: #BDBDBD;
			}

			.input-opiton {

				height: 88rpx;
				background: #F4F6F8;
				border-radius: 12rpx;
				flex: auto;
				margin-top: 16rpx;
				padding-left: 32rpx;
				padding-right: 32rpx;
				display: flex;
				align-items: center;

				.input-class {
					flex: auto;
					text-align: center;
					font-size: 28rpx;
					font-weight: 500;
					color: #2F2525;
				}

				.pl {
					font-size: 28rpx;
				}

				.right-icon {
					flex: none;
					width: 24rpx;
					height: 12rpx;
				}
			}


		}

		.btn-submit {
			margin-top: 48rpx;
			width: 312rpx;
			height: 78rpx;
			line-height: 78rpx;
			text-align: center;
			background: #209E9A;
			border-radius: 56rpx;
			font-weight: 500;
			font-size: 28rpx;
			color: #FFFFFF;
		}
	}
</style>